home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / go / prog / sgf2mi13.taz / sgf2mi13 / tools.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-27  |  1.4 KB  |  60 lines

  1. /* #[info:            */
  2. /************************************************************************
  3.  *                                    *
  4.  *          #######  ####   ####  #       ####            *
  5.  *             #    #    # #    # #      #                *
  6.  *             #    #    # #    # #      #                *
  7.  *             #    #    # #    # #       ###             *
  8.  *             #    #    # #    # #          #            *
  9.  *             #    #    # #    # #          #            *
  10.  *             #     ####   ####  ###### ####             *
  11.  *                                    *
  12.  *                Jan van der Steen                *
  13.  *                                    *
  14.  *          Centre for Mathematics and Computer Science        *
  15.  *              Amsterdam, the Netherlands            *
  16.  *                                    *
  17.  *----------------------------------------------------------------------*
  18.  * File    : tools.c                         *
  19.  * Purpose : Various tools                        *
  20.  * Version : 1.1                         *
  21.  * Modified: 11/8/92 17:00:54                        *
  22.  * Author  : Jan van der Steen (jansteen@cwi.nl)             *
  23.  ************************************************************************/
  24. /* #]info:            */ 
  25. /* #[include:            */
  26.  
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <string.h>
  30. #include "tools.h"
  31.  
  32. /* #]include:            */ 
  33.  
  34. /* #[string_alloc:        */
  35.  
  36. char *
  37. string_alloc(s)
  38. char *s;
  39. {
  40.     char *t = (char *) malloc(strlen(s)+1);
  41.  
  42.     if (t == (char *) 0) {
  43.     fprintf(stderr, "Out of memory in string_alloc\n");
  44.     exit(1);
  45.     }
  46.     return t;
  47. }
  48.  
  49. /* #]string_alloc:        */ 
  50. /* #[string_store:        */
  51.  
  52. char *
  53. string_store(s)
  54. char *s;
  55. {
  56.     return strcpy(string_alloc(s), s);
  57. }
  58.  
  59. /* #]string_store:        */ 
  60.